package com.pcbly.web;

import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

public class Constants {
	public static  String BUNDLE_KEY = "globalMessages";

	public static  String ENC_ALGORITHM = "algorithm";

	public static String LEFT_SYSTEM_MENU="leftSystemMenu";
	public static String LEFT_SYSTEM_MENU_COUNT="leftSystemMenuCount";
	public static String ROOTPATH = "";
	public static boolean USE_URL_REWRITE = false;
	public static boolean USE_CLUSTER = false;
	public static String SERVLET_MAPPING = "*.crm";
	public static int POST_STORAGE_MODE = 0;

	public static  String ENCRYPT_PASSWORD = "encryptPassword";

	public static  String FILE_SEP ;

	public static  String USER_HOME ;

	public static  String CONFIG = "appConfig";

	public static  String PREFERRED_LOCALE_KEY = "org.apache.struts2.action.LOCALE";

	public static  String USER_KEY = "userForm";

	public static  String USER_LIST = "userList";

	public static  String REGISTERED = "registered";

	public static  String ADMIN_ROLE = "ROLE_ADMIN";

	public static  String USER_ROLE = "ROLE_USER";

	public static  String USER_ROLES = "userRoles";

	public static  String AVAILABLE_ROLES = "availableRoles";

	public static  String CSS_THEME = "csstheme";

	public  static String USER_IN_SESSION = "constant.user_in_session";
	public static  String USER_SESSION_KEY = "user_session";
	public static  boolean USE_PERMISSION_CACHE = true;

	private static ResourceBundle rs ;
	
	public  static String MESSAGE_BUNDLE_KEY;

	public  static String ERROR_BUNDLE_KEY;

	public  static int DEFAULT_PAGE_SIZE ;
	public  static String PERMISSION_IS_EXIST  ;
	public  static String RESOURCENAME_IS_EXIST  ;
	public  static String RESOURCESTRING_IS_EXIST ;
	public  static String ROLE_IS_EXIST ;
	public  static String USER_IS_EXIST ;
	static{
		rs=ResourceBundle.getBundle("config/crminit");
		FILE_SEP =rs.getString("file.separator");
		USER_HOME = rs.getString("user.home")+ FILE_SEP;
		MESSAGE_BUNDLE_KEY = rs.getString("constant.message_bundle_key");
		ERROR_BUNDLE_KEY = rs.getString("constant.error_bundle_key");
		DEFAULT_PAGE_SIZE = Integer.parseInt(rs.getString("constant.default_page_size"));
		if(DEFAULT_PAGE_SIZE==0){
			DEFAULT_PAGE_SIZE=20;
		}
		PERMISSION_IS_EXIST = rs.getString("constant.permission_is_exist");
		RESOURCENAME_IS_EXIST = rs.getString("constant.resourcename_is_exist");
		RESOURCESTRING_IS_EXIST = rs.getString("constant.resourcestring_is_exist");
		ROLE_IS_EXIST = rs.getString("constant.role_is_exist");
		USER_IS_EXIST = rs.getString("constant.user_is_exist");
		
	}
	public static  String CHARSET = "UTF-8";

	public static  String BEANPERFIX = "com.pcbly.web.bean.";

	public static  HashMap<String, String> ICON_MAP = new HashMap<String, String>();

	public static  boolean ISTRUE = Boolean.TRUE;// 1
	public static  boolean ISFALSE = Boolean.FALSE;// 0

	public static  String STATUS_AUTH = "1";
	public static  String STATUS_UNAUTH = "0";
	public static  String STATUS_INVALID = "0";
	public static  String STATUS_VALID = "1";

	public static  String RESOURCE_URL = "URL";
	public static  String RESOURCE_FUNCTION = "FUNCTION";
	public static  String RESOURCE_COMPONENT = "COMPONENT";
	
	/****login ladp*******/
	public static  int LOGIN_NORMAL=0;
	public static  int LOGIN_USR_PWD_NOT_MATCHED=1;
	public static  int LOGIN_DISABLED=2;
	public static  int LOGIN_NOT_EXISTED=3;
	public static  int LOGIN_LADP_ERROR=4;

	public static  long TIME_TO_LIVE_MAX_MILLISECOND = 1000;

	public static  String FILE_UPLOADSTATUS_BEAN_KEY = null;

	public static  String FILE_UPLOADSTATUS_BEAN_LIST_KEY = null;

	public static  int SESSION_ID_SIZE = 0;

	public static  long TIMER_INTERVAL_MILLIS = 0;

	public static  String SESSION_KEY = null;

	public static  String FORWARDURL_KEY = null;
	/****login ladp*******/
	
	public Constants(){
		
	}
	public static Map<String, String> statusEnum() {
		Map<String, String> statusEnum = new HashMap<String, String>();
		statusEnum.put(STATUS_INVALID, "无效");
		statusEnum.put(STATUS_VALID, "有效");
		return statusEnum;
	}

	public static Map<String, String> resTypeEnum() {
		Map<String, String> resTypeEnum = new HashMap<String, String>();
		resTypeEnum.put("URL", RESOURCE_URL);
		resTypeEnum.put("FUNCTION", RESOURCE_FUNCTION);
		resTypeEnum.put("COMPONENT", RESOURCE_COMPONENT);
		return resTypeEnum;
	}

	public static Map<String, String> authEnum() {
		Map<String, String> authEnum = new HashMap<String, String>();
		authEnum.put(STATUS_AUTH, "已授权");
		authEnum.put(STATUS_UNAUTH, "未授权");
		return authEnum;
	}
	
	/********send email flag******/
	public static int EMAIL_FLAG_TO=1;
	public static int EMAIL_FLAG_CC=2;
	public static int EMAIL_FLAG_BCC=3; 
	public static int EMAIL_FLAG_FROM=4;
	
	public static int EMAIL_FLAG_RECEIVE=1;
	public static int EMAIL_FLAG_SEND=2;
	
	public static int EMAIL_READ_FLAG=1;
	public static int EMAIL_NOTREAD_FLAG=-1;
	 
	public static int EMAIL_FLAG_BOX_RECIEVE=1;// 
	public static int EMAIL_FLAG_BOX_ANSWERED=2;//has been answered
	public static int EMAIL_FLAG_BOX_SEND=3;
	public static int EMAIL_FLAG_BOX_DRAFT=4;
	public static int EMAIL_FLAG_BOX_DELETE=5;	
	public static int EMAIL_FLAG_BOX_DELETE_NOTDISPLAY=6;
	
	public static String USER_LEVEL_ONE="";
	
	
	//--------------dictionary entity start---------
	public static final String DICTIONARY_USER_POSITION="4028ffbc25348e7401253491dff50004";
	//--------------dictionary entity end---------
	
	//--------------------------customer dictionary start---------------------- 
	public static final String CUSTOMER_SOURCE="4028ffbc24c736d10124c77c615f0019";
	public static final String CUSTOMER_LEVEL="4028ffbc24c736d10124c7772b6f000c";
	public static final String CUSTOMER_KIND="402881e825cec32a0125cecf1e320006";
	public static final String CUSTOMER_TRADE="4028ffbc24c736d10124c7878bd4002f";
	
	public static final String CUSTOMER_REGION="4028ffbc24c736d10124c76c5d290003";
	public static final String CUSTOMER_DEALING="4028ffbc25debe8d0125dee46dd90010";
	public static final String CUSTOMER_SCALE="4028ffbc24c736d10124c77e8c9b0026";
	
	//--------------------------customer dictionary end----------------------
	
	public static final String ACCOUNT_TYPE="4028ffbc25fdb2400125fdc229d60002";
	public static final String MODEL_ACTION="4028ffbc2602d377012602df34d8006e";
	
}
